<template>
    <div class="stulist" >
          <span class="name">窗口：</span> <span class="nicheng">{{ item.canteenWindowName }}</span> 
          <van-icon name="ellipsis" size="30" @click="Show"/>
                          <van-action-sheet
                            v-model="show"
                            :actions="actions"
                            cancel-text="取消"
                            close-on-click-action
                            @cancel="onCancel"
                            @select="onSelect"
                          /> <br>
          <span class="tiezi">菜品：</span> 
          <span><ul>
              <li v-for="dish in item.dishList" :key="dish.dishName">
              <span class="title">{{ dish.dishName }}</span> 
              </li>
          </ul></span>
       </div>
  </template>
  
  <script>
  import {deleteShang} from '@/api/guanli/stuguan'
  export default {
      data() {
          return {
              active:0,
              value:'',
              stulist:[],
              show: false,
              actions:[{ name: '删除' }],
          }
      },
      props: {
      item: {
        type: Object,
        default: () => {
          return {}
        },
      }
    },
    // created(){
    //    console.log(this.item.dishList);
    // },
    methods:{
      Show(){
          this.show=true
      },
      onCancel() {
       this.$toast('取消')
      },
      onSelect(item) {
          if(item.name=='删除'){
              this.DeleteCommend()
              this.$toast('删除成功');
          
          }
      },
  
  
       //删除定义方法
       DeleteCommend(){
          console.log('要删的id',this.item.canteenWindowId);
          deleteShang(this.item.canteenWindowId)
          .then((res)=>{
            this.$toast('删除成功');
            location.reload();
              // console.log('删除返回响应值',res);
          })
      },
  
  }
  }
  </script>
  
  <style lang="less" scoped>
  
  .stulist{
      margin-top: 15px;
      background-color: #f5f7f9;
      border-radius: 20px;
      .name{
          margin-left: 15px;
          font-size: 15px;
          font-weight: 600;
      }
      .nicheng{
          margin-left: 35px;
          font-size: 15px;
          font-weight: 400;
      }
      .tiezi{
        width: 60px;
    /* display: block; */
    margin-left: 4vw;
    /* margin-top: 5.33333vw; */
    font-size: 4vw;
    font-weight: 600;
      }
      .title{
        //   display: block;
          width: 80px;
          margin-left: 100px;
        //   margin-top: -16px;
          font-size: 15px;
        //   overflow: hiddden;
          text-overflow: ellipsis;
          white-space: nowrap;
      }
      li{
        display: block;
        margin-top: 10px      }
    }
  .van-icon{
      size: 20px;
      margin-left: 15px;
  }
  .van-icon-ellipsis{
      display: block;
      margin-left: 84.66667vw;
      margin-top: -22px;
  }
  
  </style>